﻿using System;

namespace nsadv.Statistic.Domain
{
	public enum EventType
	{
		Show = 0,
		Click = 1,
		Call = 2,
		AppStore = 3,
		iTunes = 4,
		Maps = 5,
		YouTube = 6,
		Email = 7,
		SMS = 8,
		ShowFullscreen = 10
	}

	public class StatisticItem : Entity
	{
		public virtual string DeviceId { get; set; }
		public virtual string DeviceLanguge { get; set; }
		public virtual string DeviceType { get; set; }
		public virtual string DeviceOS { get; set; }

		public virtual DateTime EventDate { get; set; }
		public virtual Banner Banner { get; set; }
		public virtual string ClientName { get; set; }
		public virtual int EventId { get; set; }
		public virtual EventType EventType
		{
			get { return (EventType) EventId; }
			set { EventId = (int) value; }
		}
		public virtual Place Place { get; set; }
		public virtual Platform Platform { get; set; }
		public virtual string Hash { get; set; }

		public virtual int Count { get; set; }

		public StatisticItem()
		{
			Count = 1;
		}

		public override string ToString()
		{
			return string.Format(
				"DeviceId = {0}, DeviceLanguge = {1}, DeviceType={2}, DeviceOS={3}, EventDate={4}, EventType={5}, Banner={6}, Platform={7}, Place={8}",
				DeviceId,
				DeviceLanguge,
				DeviceOS,
				DeviceType,
				EventDate,
				EventType,
				Banner == null ? "null" : Banner.Id,
				Platform == null ? "null" : Platform.Id,
				Place == null ? "null" : Place.Id);
		}
	}
}
